{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Execute this cell to install dependencies\n",
    "%pip install sf-hamilton[visualization]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Vaex + Hamilton integration [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/dagworks-inc/hamilton/blob/main/examples/vaex/notebook.ipynb) [![GitHub badge](https://img.shields.io/badge/github-view_source-2b3137?logo=github)](https://github.com/apache/hamilton/blob/main/examples/vaex/notebook.ipynb)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/konstantin/.miniconda3/envs/hamilton-vaex/lib/python3.9/site-packages/dask/dataframe/_pyarrow_compat.py:17: FutureWarning: Minimal version of pyarrow will soon be increased to 14.0.1. You are using 11.0.0. Please consider upgrading.\n",
      "  warnings.warn(\n",
      "/Users/konstantin/.miniconda3/envs/hamilton-vaex/lib/python3.9/site-packages/scipy/__init__.py:155: UserWarning: A NumPy version >=1.18.5 and <1.25.0 is required for this version of SciPy (detected version 1.26.3\n",
      "  warnings.warn(f\"A NumPy version >={np_minversion} and <{np_maxversion}\"\n"
     ]
    }
   ],
   "source": [
    "from hamilton import base, driver\n",
    "from hamilton.plugins import vaex_extensions, h_vaex"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import my_functions\n",
    "\n",
    "config = {\n",
    "    \"base_df_location\": \"dummy_value\",\n",
    "}\n",
    "adapter = base.SimplePythonGraphAdapter(result_builder=h_vaex.VaexDataFrameResult())\n",
    "dr = driver.Driver(config, my_functions, adapter=adapter)\n",
    "output_columns = [\n",
    "    \"spend\",\n",
    "    \"signups\",\n",
    "    \"spend_per_signup\",\n",
    "    \"spend_std_dev\",\n",
    "    \"spend_mean\",\n",
    "    \"spend_zero_mean_unit_variance\",\n",
    "]\n",
    "df = dr.execute(output_columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  #    spend    signups    spend_per_signup    spend_zero_mean_unit_variance    spend_std_dev    spend_mean\n",
      "  0       10          1              10                            -1.166             15.7233       28.3333\n",
      "  1       10         10               1                            -1.166             15.7233       28.3333\n",
      "  2       20         50               0.4                          -0.529999          15.7233       28.3333\n",
      "  3       40        100               0.4                           0.741999          15.7233       28.3333\n",
      "  4       40        200               0.2                           0.741999          15.7233       28.3333\n",
      "  5       50        400               0.125                         1.378             15.7233       28.3333\n"
     ]
    }
   ],
   "source": [
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 2.50.0 (0)\n",
       " -->\n",
       "<!-- Pages: 1 -->\n",
       "<svg width=\"1008pt\" height=\"428pt\"\n",
       " viewBox=\"0.00 0.00 1008.00 428.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 424)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-424 1004,-424 1004,4 -4,4\"/>\n",
       "<g id=\"clust1\" class=\"cluster\">\n",
       "<title>cluster__legend</title>\n",
       "<polygon fill=\"none\" stroke=\"black\" points=\"34.5,-225 34.5,-412 120.5,-412 120.5,-225 34.5,-225\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-396.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
       "</g>\n",
       "<!-- signups -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>signups</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M381,-266C381,-266 316,-266 316,-266 310,-266 304,-260 304,-254 304,-254 304,-214 304,-214 304,-208 310,-202 316,-202 316,-202 381,-202 381,-202 387,-202 393,-208 393,-214 393,-214 393,-254 393,-254 393,-260 387,-266 381,-266\"/>\n",
       "<text text-anchor=\"start\" x=\"322.5\" y=\"-244.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n",
       "<text text-anchor=\"start\" x=\"315\" y=\"-216.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expression</text>\n",
       "</g>\n",
       "<!-- spend_per_signup -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>spend_per_signup</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M553,-266C553,-266 434,-266 434,-266 428,-266 422,-260 422,-254 422,-254 422,-214 422,-214 422,-208 428,-202 434,-202 434,-202 553,-202 553,-202 559,-202 565,-208 565,-214 565,-214 565,-254 565,-254 565,-260 559,-266 553,-266\"/>\n",
       "<text text-anchor=\"start\" x=\"433\" y=\"-244.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n",
       "<text text-anchor=\"start\" x=\"460\" y=\"-216.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expression</text>\n",
       "</g>\n",
       "<!-- signups&#45;&gt;spend_per_signup -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>signups&#45;&gt;spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.18,-234C399.16,-234 405.46,-234 411.85,-234\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"411.94,-237.5 421.94,-234 411.94,-230.5 411.94,-237.5\"/>\n",
       "</g>\n",
       "<!-- base_df -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>base_df</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M263,-225C263,-225 196,-225 196,-225 190,-225 184,-219 184,-213 184,-213 184,-173 184,-173 184,-167 190,-161 196,-161 196,-161 263,-161 263,-161 269,-161 275,-167 275,-173 275,-173 275,-213 275,-213 275,-219 269,-225 263,-225\"/>\n",
       "<text text-anchor=\"start\" x=\"203.5\" y=\"-203.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">base_df</text>\n",
       "<text text-anchor=\"start\" x=\"195\" y=\"-175.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- base_df&#45;&gt;signups -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>base_df&#45;&gt;signups</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M275.07,-208.62C281.25,-210.79 287.66,-213.03 293.99,-215.25\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"293.24,-218.69 303.83,-218.7 295.55,-212.09 293.24,-218.69\"/>\n",
       "</g>\n",
       "<!-- spend -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>spend</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M381,-184C381,-184 316,-184 316,-184 310,-184 304,-178 304,-172 304,-172 304,-132 304,-132 304,-126 310,-120 316,-120 316,-120 381,-120 381,-120 387,-120 393,-126 393,-132 393,-132 393,-172 393,-172 393,-178 387,-184 381,-184\"/>\n",
       "<text text-anchor=\"start\" x=\"328.5\" y=\"-162.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n",
       "<text text-anchor=\"start\" x=\"315\" y=\"-134.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expression</text>\n",
       "</g>\n",
       "<!-- base_df&#45;&gt;spend -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>base_df&#45;&gt;spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M275.07,-177.38C281.25,-175.21 287.66,-172.97 293.99,-170.75\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.55,-173.91 303.83,-167.3 293.24,-167.31 295.55,-173.91\"/>\n",
       "</g>\n",
       "<!-- spend_zero_mean -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>spend_zero_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M723,-146C723,-146 606,-146 606,-146 600,-146 594,-140 594,-134 594,-134 594,-94 594,-94 594,-88 600,-82 606,-82 606,-82 723,-82 723,-82 729,-82 735,-88 735,-94 735,-94 735,-134 735,-134 735,-140 729,-146 723,-146\"/>\n",
       "<text text-anchor=\"start\" x=\"605\" y=\"-124.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n",
       "<text text-anchor=\"start\" x=\"641.5\" y=\"-96.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">ndarray</text>\n",
       "</g>\n",
       "<!-- spend_zero_mean_unit_variance -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M988,-105C988,-105 776,-105 776,-105 770,-105 764,-99 764,-93 764,-93 764,-53 764,-53 764,-47 770,-41 776,-41 776,-41 988,-41 988,-41 994,-41 1000,-47 1000,-53 1000,-53 1000,-93 1000,-93 1000,-99 994,-105 988,-105\"/>\n",
       "<text text-anchor=\"start\" x=\"775\" y=\"-83.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n",
       "<text text-anchor=\"start\" x=\"859\" y=\"-55.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">ndarray</text>\n",
       "</g>\n",
       "<!-- spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M735.17,-100.75C741.22,-99.59 747.46,-98.41 753.79,-97.2\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"754.63,-100.61 763.8,-95.3 753.32,-93.73 754.63,-100.61\"/>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_zero_mean -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.33,-157.94C437.22,-162.65 506.48,-166.69 565,-155 572.12,-153.58 579.36,-151.63 586.53,-149.35\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"587.9,-152.58 596.24,-146.06 585.65,-145.96 587.9,-152.58\"/>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_per_signup -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.18,-177.05C404.11,-183.32 416.07,-190.17 427.78,-196.89\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"426.26,-200.05 436.67,-201.99 429.74,-193.98 426.26,-200.05\"/>\n",
       "</g>\n",
       "<!-- spend_std_dev -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>spend_std_dev</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M542,-64C542,-64 445,-64 445,-64 439,-64 433,-58 433,-52 433,-52 433,-12 433,-12 433,-6 439,0 445,0 445,0 542,0 542,0 548,0 554,-6 554,-12 554,-12 554,-52 554,-52 554,-58 548,-64 542,-64\"/>\n",
       "<text text-anchor=\"start\" x=\"444\" y=\"-42.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n",
       "<text text-anchor=\"start\" x=\"480.5\" y=\"-14.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_std_dev -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_std_dev</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M375.07,-119.88C388.14,-104.63 404.89,-86.77 422,-73 423.17,-72.06 424.37,-71.12 425.58,-70.19\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"427.81,-72.91 433.86,-64.21 423.71,-67.23 427.81,-72.91\"/>\n",
       "</g>\n",
       "<!-- spend_mean -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>spend_mean</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M534.5,-146C534.5,-146 452.5,-146 452.5,-146 446.5,-146 440.5,-140 440.5,-134 440.5,-134 440.5,-94 440.5,-94 440.5,-88 446.5,-82 452.5,-82 452.5,-82 534.5,-82 534.5,-82 540.5,-82 546.5,-88 546.5,-94 546.5,-94 546.5,-134 546.5,-134 546.5,-140 540.5,-146 534.5,-146\"/>\n",
       "<text text-anchor=\"start\" x=\"451.5\" y=\"-124.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n",
       "<text text-anchor=\"start\" x=\"480.5\" y=\"-96.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_mean -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.18,-140.39C404.91,-137.28 417.83,-133.84 430.35,-130.51\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"431.52,-133.83 440.28,-127.88 429.72,-127.06 431.52,-133.83\"/>\n",
       "</g>\n",
       "<!-- spend_std_dev&#45;&gt;spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>spend_std_dev&#45;&gt;spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M554.04,-38.32C607.01,-43.94 686.27,-52.34 753.49,-59.47\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"753.43,-62.99 763.74,-60.56 754.17,-56.03 753.43,-62.99\"/>\n",
       "</g>\n",
       "<!-- spend_mean&#45;&gt;spend_zero_mean -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>spend_mean&#45;&gt;spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M546.58,-114C558.37,-114 571.15,-114 583.78,-114\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"583.86,-117.5 593.86,-114 583.86,-110.5 583.86,-117.5\"/>\n",
       "</g>\n",
       "<!-- _base_df_inputs -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>_base_df_inputs</title>\n",
       "<polygon fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"155,-215.5 0,-215.5 0,-170.5 155,-170.5 155,-215.5\"/>\n",
       "<text text-anchor=\"start\" x=\"15.5\" y=\"-188.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">base_df_location</text>\n",
       "<text text-anchor=\"start\" x=\"124.5\" y=\"-188.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n",
       "</g>\n",
       "<!-- _base_df_inputs&#45;&gt;base_df -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>_base_df_inputs&#45;&gt;base_df</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M155.26,-193C161.54,-193 167.8,-193 173.87,-193\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"173.88,-196.5 183.88,-193 173.88,-189.5 173.88,-196.5\"/>\n",
       "</g>\n",
       "<!-- input -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>input</title>\n",
       "<polygon fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"104.5,-380.5 50.5,-380.5 50.5,-343.5 104.5,-343.5 104.5,-380.5\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-358.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n",
       "</g>\n",
       "<!-- function -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>function</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M100.5,-325.5C100.5,-325.5 54.5,-325.5 54.5,-325.5 48.5,-325.5 42.5,-319.5 42.5,-313.5 42.5,-313.5 42.5,-300.5 42.5,-300.5 42.5,-294.5 48.5,-288.5 54.5,-288.5 54.5,-288.5 100.5,-288.5 100.5,-288.5 106.5,-288.5 112.5,-294.5 112.5,-300.5 112.5,-300.5 112.5,-313.5 112.5,-313.5 112.5,-319.5 106.5,-325.5 100.5,-325.5\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-303.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
       "</g>\n",
       "<!-- output -->\n",
       "<g id=\"node12\" class=\"node\">\n",
       "<title>output</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M95.5,-270.5C95.5,-270.5 59.5,-270.5 59.5,-270.5 53.5,-270.5 47.5,-264.5 47.5,-258.5 47.5,-258.5 47.5,-245.5 47.5,-245.5 47.5,-239.5 53.5,-233.5 59.5,-233.5 59.5,-233.5 95.5,-233.5 95.5,-233.5 101.5,-233.5 107.5,-239.5 107.5,-245.5 107.5,-245.5 107.5,-258.5 107.5,-258.5 107.5,-264.5 101.5,-270.5 95.5,-270.5\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-248.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.graphs.Digraph at 0x1664d4d90>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dr.visualize_execution(output_columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 2.50.0 (0)\n",
       " -->\n",
       "<!-- Pages: 1 -->\n",
       "<svg width=\"1008pt\" height=\"373pt\"\n",
       " viewBox=\"0.00 0.00 1008.00 373.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 369)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-369 1004,-369 1004,4 -4,4\"/>\n",
       "<g id=\"clust1\" class=\"cluster\">\n",
       "<title>cluster__legend</title>\n",
       "<polygon fill=\"none\" stroke=\"black\" points=\"34.5,-225 34.5,-357 120.5,-357 120.5,-225 34.5,-225\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-341.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
       "</g>\n",
       "<!-- signups -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>signups</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M381,-266C381,-266 316,-266 316,-266 310,-266 304,-260 304,-254 304,-254 304,-214 304,-214 304,-208 310,-202 316,-202 316,-202 381,-202 381,-202 387,-202 393,-208 393,-214 393,-214 393,-254 393,-254 393,-260 387,-266 381,-266\"/>\n",
       "<text text-anchor=\"start\" x=\"322.5\" y=\"-244.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n",
       "<text text-anchor=\"start\" x=\"315\" y=\"-216.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expression</text>\n",
       "</g>\n",
       "<!-- spend_per_signup -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>spend_per_signup</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M553,-266C553,-266 434,-266 434,-266 428,-266 422,-260 422,-254 422,-254 422,-214 422,-214 422,-208 428,-202 434,-202 434,-202 553,-202 553,-202 559,-202 565,-208 565,-214 565,-214 565,-254 565,-254 565,-260 559,-266 553,-266\"/>\n",
       "<text text-anchor=\"start\" x=\"433\" y=\"-244.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n",
       "<text text-anchor=\"start\" x=\"460\" y=\"-216.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expression</text>\n",
       "</g>\n",
       "<!-- signups&#45;&gt;spend_per_signup -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>signups&#45;&gt;spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.18,-234C399.16,-234 405.46,-234 411.85,-234\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"411.94,-237.5 421.94,-234 411.94,-230.5 411.94,-237.5\"/>\n",
       "</g>\n",
       "<!-- base_df -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>base_df</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M263,-225C263,-225 196,-225 196,-225 190,-225 184,-219 184,-213 184,-213 184,-173 184,-173 184,-167 190,-161 196,-161 196,-161 263,-161 263,-161 269,-161 275,-167 275,-173 275,-173 275,-213 275,-213 275,-219 269,-225 263,-225\"/>\n",
       "<text text-anchor=\"start\" x=\"203.5\" y=\"-203.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">base_df</text>\n",
       "<text text-anchor=\"start\" x=\"195\" y=\"-175.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- base_df&#45;&gt;signups -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>base_df&#45;&gt;signups</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M275.07,-208.62C281.25,-210.79 287.66,-213.03 293.99,-215.25\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"293.24,-218.69 303.83,-218.7 295.55,-212.09 293.24,-218.69\"/>\n",
       "</g>\n",
       "<!-- spend -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M381,-184C381,-184 316,-184 316,-184 310,-184 304,-178 304,-172 304,-172 304,-132 304,-132 304,-126 310,-120 316,-120 316,-120 381,-120 381,-120 387,-120 393,-126 393,-132 393,-132 393,-172 393,-172 393,-178 387,-184 381,-184\"/>\n",
       "<text text-anchor=\"start\" x=\"328.5\" y=\"-162.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n",
       "<text text-anchor=\"start\" x=\"315\" y=\"-134.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expression</text>\n",
       "</g>\n",
       "<!-- base_df&#45;&gt;spend -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>base_df&#45;&gt;spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M275.07,-177.38C281.25,-175.21 287.66,-172.97 293.99,-170.75\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.55,-173.91 303.83,-167.3 293.24,-167.31 295.55,-173.91\"/>\n",
       "</g>\n",
       "<!-- spend_zero_mean -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>spend_zero_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M723,-146C723,-146 606,-146 606,-146 600,-146 594,-140 594,-134 594,-134 594,-94 594,-94 594,-88 600,-82 606,-82 606,-82 723,-82 723,-82 729,-82 735,-88 735,-94 735,-94 735,-134 735,-134 735,-140 729,-146 723,-146\"/>\n",
       "<text text-anchor=\"start\" x=\"605\" y=\"-124.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n",
       "<text text-anchor=\"start\" x=\"641.5\" y=\"-96.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">ndarray</text>\n",
       "</g>\n",
       "<!-- spend_zero_mean_unit_variance -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M988,-105C988,-105 776,-105 776,-105 770,-105 764,-99 764,-93 764,-93 764,-53 764,-53 764,-47 770,-41 776,-41 776,-41 988,-41 988,-41 994,-41 1000,-47 1000,-53 1000,-53 1000,-93 1000,-93 1000,-99 994,-105 988,-105\"/>\n",
       "<text text-anchor=\"start\" x=\"775\" y=\"-83.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n",
       "<text text-anchor=\"start\" x=\"859\" y=\"-55.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">ndarray</text>\n",
       "</g>\n",
       "<!-- spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M735.17,-100.75C741.22,-99.59 747.46,-98.41 753.79,-97.2\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"754.63,-100.61 763.8,-95.3 753.32,-93.73 754.63,-100.61\"/>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_zero_mean -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.33,-157.94C437.22,-162.65 506.48,-166.69 565,-155 572.12,-153.58 579.36,-151.63 586.53,-149.35\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"587.9,-152.58 596.24,-146.06 585.65,-145.96 587.9,-152.58\"/>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_per_signup -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.18,-177.05C404.11,-183.32 416.07,-190.17 427.78,-196.89\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"426.26,-200.05 436.67,-201.99 429.74,-193.98 426.26,-200.05\"/>\n",
       "</g>\n",
       "<!-- spend_std_dev -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>spend_std_dev</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M542,-64C542,-64 445,-64 445,-64 439,-64 433,-58 433,-52 433,-52 433,-12 433,-12 433,-6 439,0 445,0 445,0 542,0 542,0 548,0 554,-6 554,-12 554,-12 554,-52 554,-52 554,-58 548,-64 542,-64\"/>\n",
       "<text text-anchor=\"start\" x=\"444\" y=\"-42.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n",
       "<text text-anchor=\"start\" x=\"480.5\" y=\"-14.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_std_dev -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_std_dev</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M375.07,-119.88C388.14,-104.63 404.89,-86.77 422,-73 423.17,-72.06 424.37,-71.12 425.58,-70.19\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"427.81,-72.91 433.86,-64.21 423.71,-67.23 427.81,-72.91\"/>\n",
       "</g>\n",
       "<!-- spend_mean -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>spend_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M534.5,-146C534.5,-146 452.5,-146 452.5,-146 446.5,-146 440.5,-140 440.5,-134 440.5,-134 440.5,-94 440.5,-94 440.5,-88 446.5,-82 452.5,-82 452.5,-82 534.5,-82 534.5,-82 540.5,-82 546.5,-88 546.5,-94 546.5,-94 546.5,-134 546.5,-134 546.5,-140 540.5,-146 534.5,-146\"/>\n",
       "<text text-anchor=\"start\" x=\"451.5\" y=\"-124.8\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n",
       "<text text-anchor=\"start\" x=\"480.5\" y=\"-96.8\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- spend&#45;&gt;spend_mean -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>spend&#45;&gt;spend_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M393.18,-140.39C404.91,-137.28 417.83,-133.84 430.35,-130.51\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"431.52,-133.83 440.28,-127.88 429.72,-127.06 431.52,-133.83\"/>\n",
       "</g>\n",
       "<!-- spend_std_dev&#45;&gt;spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>spend_std_dev&#45;&gt;spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M554.04,-38.32C607.01,-43.94 686.27,-52.34 753.49,-59.47\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"753.43,-62.99 763.74,-60.56 754.17,-56.03 753.43,-62.99\"/>\n",
       "</g>\n",
       "<!-- spend_mean&#45;&gt;spend_zero_mean -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>spend_mean&#45;&gt;spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M546.58,-114C558.37,-114 571.15,-114 583.78,-114\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"583.86,-117.5 593.86,-114 583.86,-110.5 583.86,-117.5\"/>\n",
       "</g>\n",
       "<!-- _base_df_inputs -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>_base_df_inputs</title>\n",
       "<polygon fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"155,-215.5 0,-215.5 0,-170.5 155,-170.5 155,-215.5\"/>\n",
       "<text text-anchor=\"start\" x=\"15.5\" y=\"-188.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">base_df_location</text>\n",
       "<text text-anchor=\"start\" x=\"124.5\" y=\"-188.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n",
       "</g>\n",
       "<!-- _base_df_inputs&#45;&gt;base_df -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>_base_df_inputs&#45;&gt;base_df</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M155.26,-193C161.54,-193 167.8,-193 173.87,-193\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"173.88,-196.5 183.88,-193 173.88,-189.5 173.88,-196.5\"/>\n",
       "</g>\n",
       "<!-- input -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>input</title>\n",
       "<polygon fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"104.5,-325.5 50.5,-325.5 50.5,-288.5 104.5,-288.5 104.5,-325.5\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-303.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n",
       "</g>\n",
       "<!-- function -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>function</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M100.5,-270.5C100.5,-270.5 54.5,-270.5 54.5,-270.5 48.5,-270.5 42.5,-264.5 42.5,-258.5 42.5,-258.5 42.5,-245.5 42.5,-245.5 42.5,-239.5 48.5,-233.5 54.5,-233.5 54.5,-233.5 100.5,-233.5 100.5,-233.5 106.5,-233.5 112.5,-239.5 112.5,-245.5 112.5,-245.5 112.5,-258.5 112.5,-258.5 112.5,-264.5 106.5,-270.5 100.5,-270.5\"/>\n",
       "<text text-anchor=\"middle\" x=\"77.5\" y=\"-248.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.graphs.Digraph at 0x1664d0790>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dr.display_all_functions()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "hamilton-vaex",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
